import { globalShortcut, BrowserWindow } from 'electron'

function Shortcut() {
  let win = BrowserWindow.getFocusedWindow()
  //   设置快捷键 ctrl+shift+i,控制控制台开关
  globalShortcut.register('CommandOrControl+shift+i', () => {
    if (win?.webContents.isDevToolsOpened()) {
      win?.webContents.closeDevTools()
    } else {
      win?.webContents.openDevTools()
    }
  })
  //设置快捷键 ctrl+shift+q,刷新
  globalShortcut.register('CommandOrControl+shift+q', () => {
    win?.webContents.reload()
  })
}
export default Shortcut
